<?php

require_once 'PB/PB.php';
require_once 'projekt_st/spletne/controller/OsebaController.php';
require_once 'projekt_st/spletne/entity/Povezave.php';

include_once("seja.php"); 
{
    
$controller = new OsebaController();
if($_SESSION["tipUporabnika"]=="student"){
	$povezave = $controller->getPovezaveControl($_SESSION['uporabnik']['idoseba']);
}

//print_r($_SESSION);
if(isset($_POST['edit'])) {
    array_pop($_POST);
    $pove = $_POST;
    $pove['oseba_idoseba'] = $_SESSION['uporabnik']['idoseba'];
    $controller->setPovezaveControl($pove);
    
    header("Location: http://".$streznik."".$pot."/prva.php");  
    
}

?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>StudentWorld</title>
    <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<?php
//naredi include, mora biti {}
 
?>

    <div id="wrapper">
    	<div id="header-wrapper">
        
    		<?php include_once("glava.php"); ?>
            
    	</div>
    	<!-- end #header -->
    	<div id="page">
    		<div id="page-bgtop">
    			<div id="page-bgbtm">
    				<div id="content">
    					<div class="post">    						
    						<div style="clear: both;">&nbsp;</div>
    						<div class="entry">
                            <?php

                            if ($_SESSION['tipUporabnika']=='profesor') {
                                echo "<p>Pozdravljen profesor, ocenite svojega študenta!</p>";
                            } else if ($_SESSION['tipUporabnika']=='admin') {
                                echo "<p>Pozdravljen admin, dobrodošli v administraciji!</p>";
                            } else if ($_SESSION['tipUporabnika']=='student') {
                                echo "<h1>Dodaj povezavo</h1>";
                                ?><form method="post" action=<?php echo $_SERVER['PHP_SELF']?>>
                                    <table>
                                        <tr>
                                            <td>
                                            Vnesi status
                                            </td>
                                            <td><input type="text" name="imePovezave" id="imePovezave" value="" /></td>
                                        </tr>
                                        <tr>
                                        <td>
                                            Vnesi povezavo (opcijsko)
                                        </td>
                                            <td><input type="text" name="naslovPovezave" id="naslovPovezave" value="" /></td>
                                        <tr>
                                            <td><input type="submit" id="edit" name="edit" value="Dodaj" /></td>
                                        </tr>
                                            
                                        
                                        </tr>
                                    </table>
                                </form><?php
                                foreach($povezave as $pov):
                                echo $pov->getImePovezave()." <a href = ".$pov->getNaslovPovezave().">".$pov->getNaslovPovezave()."</a></p>";
                            	endforeach;
                            }
                            
                            
                            
                            
                            
                            
                            
?>
    						</div>
    					</div>
    					
    					<div style="clear: both;">&nbsp;</div>
    				</div>
    				<!-- end #content -->
    				<div id="sidebar">
    					<ul>
    						
                            <?php

                                include_once('sidebar.php');

?>
                            
    						<!-- <li>
    							<h2>Categories</h2>
    							<ul>
    								<li><a href="#">Aliquam libero</a></li>
    								<li><a href="#">Consectetuer adipiscing elit</a></li>
    								<li><a href="#">Metus aliquam pellentesque</a></li>
    								<li><a href="#">Suspendisse iaculis mauris</a></li>
    								<li><a href="#">Urnanet non molestie semper</a></li>
    								<li><a href="#">Proin gravida orci porttitor</a></li>
    							</ul>
    						</li> -->
    					</ul>
    				</div>
    				<!-- end #sidebar -->
    				<div style="clear: both;">&nbsp;</div>
    			</div>
    		</div>
    	</div>
    	<!-- end #page -->
    </div>
    <?php  include_once("noga.php"); } ?>
    <!-- end #footer -->
</body>
</html>
